#!/usr/local/bin/python3

import hid

ID_VENDOR_LEGO = 0x0694
ID_PRODUCT_EV3 = 0x0005

hidraw = hid.device(ID_VENDOR_LEGO, ID_PRODUCT_EV3)
hidraw.open(ID_VENDOR_LEGO, ID_PRODUCT_EV3)

manufacturer_string = hidraw.get_manufacturer_string()

print(manufacturer_string)


product_string = hidraw.get_product_string()

print(product_string)


serial_number_string = hidraw.get_serial_number_string()

print(serial_number_string)


# indexed_string = hidraw.get_indexed_string()
#
# print(indexed_string)

# hidraw.write([0x0D, 0x00, 0x01, 0x00, 0x80, 0x00, 0x00, 0xA4, 0x00, 0x09, 0x81,
#         0x32, 0xA6, 0x00, 0x09])

# hidraw.write([0x09, 0x00, 0x02, 0x00, 0x80, 0x00, 0x00, 0xA3, 0x00, 0x09, 0x00])


hidraw.write([0x3C, 0x00, 0x01, 0x00, 0x80, 0x00, 0x00, 0x82, 0x1B,
        0x02, 0x94, 0x01, 0x01, 0x82, 0x06, 0x01, 0x82, 0xF4, 0x01, 0x96, 0x82, 0x1B, 0x01, 0x94, 0x01, 0x01,
        0x82, 0x4A, 0x01, 0x82, 0xF4, 0x01, 0x96, 0x82, 0x1B, 0x03, 0x94, 0x01, 0x01, 0x82, 0x88, 0x01, 0x82,
        0xF4, 0x01, 0x96, 0x82, 0x1B, 0x04, 0x94, 0x01, 0x02, 0x82, 0x0B, 0x02, 0x82, 0xE8, 0x03, 0x01, 0x82,
        0x1B, 0x01])


#hidraw.send_feature_report([0x0D, 0x00, 0x01, 0x00, 0x80, 0x00, 0x00, 0xA4, 0x00, 0x09, 0x81,
#        0x32, 0xA6, 0x00, 0x09])